
//
//  AppMacros.h
//  tryshopping.boss
//
//  Created by Mr.Lee on 16/11/8.
//  Copyright © 2016年 Reabam. All rights reserved.
//

// -------------------    尺寸定义开始  -------------------------------//
//屏幕宽高定义
#define kVCWIDTH self.view.frame.size.width
#define kVCHEIGHT self.view.frame.size.height
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
#define FullViewWidth self.frame.size.width
#define FullViewHeight self.frame.size.height

// 字体转换  px -> pt
#define FontSizeWithpx(px) px / 96 * 72
#define SystemFontWithpx(px) [UIFont systemFontOfSize:kFontSizeWithpx(px)]

// 字体转化  pt -> pt
#define FontSizeWithps(ps) kFontSizeWithpx(ps / 2)
#define SystemFontWithps(ps) [UIFont systemFontOfSize:kFontSizeWithpx(ps / 2)]

/*屏幕视频*/
#define iPhone6 ([UIScreen mainScreen].bounds.size.height == 667)
#define iPhone6P ([UIScreen mainScreen].bounds.size.height == 736)
#define iPhone5 ([UIScreen mainScreen].bounds.size.height == 568)
#define iPhone4 ([UIScreen mainScreen].bounds.size.height == 480)

#define SINGLE_LINE_ADJUST_OFFSET   ((1 / [UIScreen mainScreen].scale) / 2)

//满屏CGRect
#define FullScreenRect [UIScreen mainScreen].bounds
#define FullVCRect CGRectMake(0,0, KDeviceWidth, KDeviceHeight-64)
#define FullTabbarVCRect CGRectMake(0,0, KDeviceWidth, KDeviceHeight-64-49)

// -----------------------------    颜色定义开始  -----------------------//
#define COLOR(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define GRAYCOLOR(c) COLOR(c,c,c)
#define ColorWithAlpha(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define UIColorFromRGBValue(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RandomColorWithAlpha(a) [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:a]

//通用视觉规范
#define TSWhiteColor COLOR(255, 255, 255)          //纯白
#define TSBlueColor COLOR(0, 153, 255)             //蓝色
#define TSOrangeColor COLOR(253, 106, 60)          //橙色
#define TSYellowColor COLOR(239, 166, 68)          //黄色
#define TSBlackColor COLOR(68, 68, 68)             //浅黑色
#define TSGrayColor COLOR(102, 102, 102)           //灰色
#define TSlightGrayColor COLOR(153, 153, 153)      //浅灰色
#define TSCoffeeColor COLOR(185,152,99)            //咖啡色
#define TSCommonBgColor  COLOR(248, 248, 248)      //灰白色
#define TSSeparatorLineColor COLOR(232, 232, 232)  //分割线颜色
#define TSTranslucentColor ColorWithAlpha(0,0,0,0.55)  //半透明颜色

#define shenlan [UIColor colorWithRed:6/255.0 green:79/255.0 blue:124/255.0 alpha:1]
#define lanse [UIColor colorWithRed:8/255.0 green:128/255.0 blue:198/255.0 alpha:1]
// 蓝色七个色号
#define lanse1 [UIColor colorWithRed:236/255.0 green:248/255.0 blue:255/255.0 alpha:1]
#define lanse2 [UIColor colorWithRed:146/255.0 green:207/255.0 blue:243/255.0 alpha:1]
#define lanse3 [UIColor colorWithRed:82/255.0 green:180/255.0 blue:236/255.0 alpha:1]
#define lanse4 [UIColor colorWithRed:8/255.0 green:128/255.0 blue:198/255.0 alpha:1]
#define lanse5 [UIColor colorWithRed:10/255.0 green:95/255.0 blue:148/255.0 alpha:1]
#define lanse6 [UIColor colorWithRed:6/255.0 green:79/255.0 blue:124/255.0 alpha:1]
#define lanse7 [UIColor colorWithRed:20/255.0 green:30/255.0 blue:25/255.0 alpha:1]

#define  shenluse [UIColor colorWithRed:90/255.0 green:130/255.0 blue:26/255.0 alpha:1.0]//深一点主题绿色
#define  luseColor [UIColor colorWithRed:90/255.0 green:130/255.0 blue:26/255.0 alpha:1.0]//主题绿色
#define  hongseColor  [UIColor colorWithRed:252/255.0 green:54/255.0 blue:30/255.0 alpha:1]//红色字体1／／价格
#define  shenhongseColor  [UIColor colorWithRed:204/255.0 green:0/255.0 blue:0/255.0 alpha:1]//红色字体2／／价格
#define  qianheiColor [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]//51字体颜色
#define  zuiqianhuiColor [UIColor colorWithRed:244/255.0 green:244/255.0 blue:244/255.0 alpha:1]//248灰色块颜色
#define  qianhuiColor  [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1]//228灰色线的颜色
#define  commonLineColor  [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1]//228灰色线的颜色
#define  zhonghuiColor [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0]//153灰色字体的颜色
#define  shenhuiColor  [UIColor colorWithRed:102.00/255.0 green:102.00/255.0 blue:102.00/255.0 alpha:1]//102灰色字体的颜色
#define  tintColors  [UIColor colorWithRed:21.00/255.0 green:25.0/255.0 blue:31.00/255.0 alpha:1]//textfield的tint clolor
#define  backColor  [UIColor colorWithRed:21.00/255.0 green:25.0/255.0 blue:31.00/255.0 alpha:1]//黑蓝色
#define  Color  [UIColor colorWithRed:255.00/255.0 green:255.00/255.0 blue:255.00/255.0 alpha:1]//白色
#define TSColor(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define TSARGBColor(a, r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a];

#define  ZhuTibtn [UIColor colorWithRed:248/255.0 green:95/255.0 blue:55/255.0 alpha:1.0]//主题按钮橙
#define  ZhuTiColor [UIColor colorWithRed:248/255.0 green:95/255.0 blue:55/255.0 alpha:1.0]//主题橙

#define CommonColor [UIColor colorWithRed:8.0/255.0 green:128.0/255.0 blue:198.0/255.0 alpha:1.0]
//弹键盘view
#define alp  0.90
#define keyboardFot 17
#define viewheight     40
#define logoheight   84/3
#define logowidth     75/3
#define logoX   25
#define logoY     7
#define jiantouheight   61/3
#define jiaotouwidth     34/3
#define jiantouX   [UIScreen mainScreen].bounds.size.width -80
#define jiaotouY     15
#define jiafont [UIScreen mainScreen].bounds.size.height <659? (25):(35)
#define erweimaFot [UIScreen mainScreen].bounds.size.height <659? (20):(24)
#define thirteenfotORtwelvefot [UIScreen mainScreen].bounds.size.height <659? (12):(13)
#define  jianpancolor1  [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0]
#define  jianpancolor  [UIColor colorWithRed:209/255.0 green:214/255.0 blue:219/255.0 alpha:1]

// -------------------------------------------------    字体定义开始  -------------------------------//
#define SysFontWithSize(s) [UIFont systemFontOfSize:s]
#define PFNFontWithSize(s) [UIFont fontWithName:@"PingFangSC-Regular" size:s]
#define PFBFontWithSize(s) [UIFont fontWithName:@"PingFangSC-Thin" size:s]
#define HTFontWithSize(s) [UIFont fontWithName:@"Heiti SC" size:s]

// -------------------------------------------------    工具定义开始  -------------------------------//
//定义构造单例的宏
#define SharedInstanceInterfaceBuilder(ClassName) \
+ (instancetype)sharedInstance;

#define SharedInstanceBuilder(ClassName) \
+ (instancetype)sharedInstance\
{\
    static dispatch_once_t onceToken;\
    static ClassName* instance;\
    dispatch_once(&onceToken, ^{\
    instance = [[ClassName alloc] init];\
    });\
    return instance;\
}

//"performSelector may cause a leak because its selector is unknown"警告原因及其解决办法
#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

//"MethodDeprecatedSelectorWarning"方法过时解决办法(严重不推荐使用，除非做了严格判断知道会出问题时用来消除警告)
#define MethodDeprecatedSelectorWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

//app版本信息(升级版本号和编译版本号)
#define AppVersionNumber [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]
#define AppBuildVersionNumber [[[NSBundle mainBundle] infoDictionary] valueForKey:(NSString *)kCFBundleVersionKey]

// 打印
#ifndef __OPTIMIZE__
#define NSLog(...) NSLog(__VA_ARGS__)
//#define NSLog(fmt, ...) NSLog((@"%@:%s [Line %d] " fmt),[NSThread currentThread].name, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define NSLog(...) {}
#endif

// userDefaults
#define UserDefaults [NSUserDefaults standardUserDefaults]

// 将afn返回的数据写成plist
#define plistFileName(filename) [severDataDict.dataDict writeToFile:[NSString stringWithFormat:@"/Users/Mr.Lee/Desktop/%@.plist", filename] atomically:YES];


